package com.jiunuan.live.account.provider.rpc;

import com.jiunuan.live.account.interfaces.IAccountTokenRpc;
import com.jiunuan.live.account.provider.service.IAccountTokenService;
import jakarta.annotation.Resource;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService
public class AccountTokenRpcImpl implements IAccountTokenRpc {
    @Resource
    private IAccountTokenService accountTokenService;
    /**
     * 创建并保存登录token
     *
     * @param userId
     * @return
     */
    @Override
    public String createAndSaveLoginToken(Long userId) {
        return accountTokenService.createAndSaveLoginToken(userId);
    }

    /**
     * 根据token获取用户id,校验用户token
     *
     * @param tokenKey
     * @return
     */
    @Override
    public Long getUserIdByToken(String tokenKey) {
        return accountTokenService.getUserIdByToken(tokenKey);
    }
}
